package common.quickvalid.validators;

import java.util.Map;

/**
 * 有效数字验证
 * @author beansoft
 *
 */
public class validate_number extends BaseValidator {

	public String doValidation(String fieldName, String fieldDescription,
	        Map<String, Object> params, String... args) {
		super.setParams(params);		
		String value = getValue(fieldName);
		
		if(value != null && value.length() > 0) {
			try {
				Double.parseDouble(value);
			} catch(Exception ex) {
				return fieldDescription + "不是有效的数字";
			}
			
		}
		return null;
	}

}